package LeetCode.LeetCode2;

public class Num57 {
    public int[] twoSum(int[] nums, int target) {
        if(nums.length < 2){
            return null;
        }
        int maxNum = 0;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] > target){
                maxNum = i;
                break;
            }
        }
        int[] arr = {0,0};
        for (int i = 0; i < maxNum; i++) {
            for (int j = i; j < maxNum; j++) {
                if(nums[i] + nums[j] == target){
                    arr[0] = nums[i];
                    arr[1] = nums[j];
                    return arr;
                }
            }
        }
        return null;
    }
}
